import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Random;

public class java05 {
    public static void main(String[] args) throws Exception{
        BufferedReader fid=new BufferedReader(new FileReader("names.txt"));
        String line;
        ArrayList<String> man=new ArrayList<>();
        ArrayList<String> woman=new ArrayList<>();
        while ((line= fid.readLine())!=null){
            if(line.split("-")[1].equals("男")){
                man.add(line);
            }else {
                woman.add(line);
            }
        }
        ArrayList<String> people=new ArrayList<>();
        Random random=new Random();
        for (int i = 0; i < 7; i++) {
            int n= random.nextInt(man.size());
            people.add(man.get(n));
        }
        for (int i = 0; i < 3; i++) {
            int n= random.nextInt(woman.size());
            people.add(woman.get(n));
        }
       int n= random.nextInt(people.size());
        BufferedWriter fos=new BufferedWriter(new FileWriter("rate.txt", true));
       if(people.get(n).split("-")[1].equals("男")){
           fos.write("男");
           fos.newLine();
       }else {
           fos.write("女");
           fos.newLine();
       }
       fos.close();
       int i=0,j=0;
       String len;
       BufferedReader fis=new BufferedReader(new FileReader("rate.txt"));
while ((len= fis.readLine())!=null){
    if(len.equals("男")){
        i++;
    }else {
        j++;
    }
}
        System.out.println(people.get(n).split("-")[0]+"-"+people.get(n).split("-")[1]+" 男女比例为"+i+":"+j);
    }
}
